#include "Sheet.h"
#include "Sheet_impl.h"
#include <iostream>
#include <fstream>

Sheet* LoadSheet(const char* filename, const char* sheetname)
{
	std::ifstream sheetfile(filename, std::ios::binary | std::ios::in);
	if(!sheetfile)
		return 0;

	char* buffer;
	int size = 0;
	sheetfile.seekg(0, std::ios::end);
	size = sheetfile.tellg();
	sheetfile.seekg(0, std::ios::beg);

	buffer = new char[size+1];
	memset(buffer, 0, size+1);
	sheetfile.read(buffer, size);
	sheetfile.close();

	Sheet* sheet = CreateSheet(buffer,size);
	delete[] buffer;
	
	return sheet;
}